let container = document.querySelector('#container')
let comment = document.querySelector('.commentAll')

let regExp = /^<[^<]+\s+src="([^''""]*)"/

let id = getQueryString("productid")
console.log(id);
fetch('http://chst.vip:1234/api/getmoneyctrlproduct?productid=' + id)
    .then(body => body.json())
    .then(res => {
        console.log(res);

        let data = res.result[0];
// console.log(data);
        let match = regExp.exec(data.productImg2)
        let imgSrc = (match[1].split(';')[1].split('=')[1])
     let html = `
        <h2>${data.productName}</h2>
        <div>
            <span>${data.productFrom} | ${data.productTime}</span>
            <span>${data.productTips}</span>
        </div>
        <div>
            <img src="${imgSrc}" style="width:5.3333rem" >
            <p>${data.productInfo2}</p>
        </div>
        <div id="pigImg">
        <img src="${imgSrc}" style="width:9.3333rem" >
        </div>
        <div class="city">
            ${data.productCity}
        </div>
    ` 
    let el = `
    <div>${data.productComment}</div>
    `
        container.innerHTML = html;
        comment.innerHTML = el
    })